//
//  MBDUploadGroupBaseCellModel.swift
//  MasterBoy
//
//  Created by kyson on 2024/9/5.
//

import Foundation
import YYText


class MBDUploadGroupBaseCellModel: NSObject {
    var textlayout : YYTextLayout!
    var cellHeight : CGFloat!
    
    func isEmpty() -> Bool {
        return false
    }
    
    func nextVCTitle() -> String! {
        return ""
    }
    
     var text: String? {
        didSet {
            
            let titleAttributeString = NSMutableAttributedString(string: self.text ?? "")
            titleAttributeString.yy_font = UIFont.systemFont(ofSize: 14)
            titleAttributeString.setDynamicTextColor()
            titleAttributeString.yy_lineSpacing = 6

            let userNamecontainer = YYTextContainer()
            let userNameWidth = CGRectGetWidth(UIScreen.main.bounds) - 30
            userNamecontainer.size = CGSizeMake(userNameWidth , CGFLOAT_MAX)
            userNamecontainer.maximumNumberOfRows = 0

            let titleLayout = YYTextLayout(container: userNamecontainer, text: titleAttributeString)
            self.textlayout = titleLayout
            
            self.cellHeight = 10 + titleLayout!.textBoundingSize.height + 10
        }
    }
    
}
